#ifndef MAIN_LEFT_WIDGET_H
#define MAIN_LEFT_WIDGET_H

#include <QMainWindow>
#include <QWidget>
#include <QSplitter>
#include <QTextEdit>
#include <QLayout>
#include <QImage>
#include <QPalette>
#include <QIcon>
#include <QFont>
#include <QPushButton>
#include <QPainter>
#include <QPaintEvent>
#include <QStyleOption>
#include <QCalendarWidget>
#include <QDebug>
#include <QMessageBox>
#include <QObject>
#include <QDate>

#include "displaybutton.h"
#include "simple_clock.h"

//数值是1时打印调试信息
#define hzq 1
extern QDate currentDate; //当天日期
extern QDate selectedDate;//当前被选中的日期
extern QDate dateStart;

class main_left_widget:public QWidget
{
    Q_OBJECT

public:
    main_left_widget();
    void paintEvent(QPaintEvent *event);
    void dumpStructure(const QObject *obj, int spaceCount);
    void init_calendar(QCalendarWidget *calendar);
    void getEverydayData(QDate &dateStart,QDate &dateEnd,struct styData &stydata1);
    void getEveryoneData();
    int bitCount(qulonglong number);
private:
    QPushButton *btn_study;
    QPushButton *btn_friend;
    QPushButton *btn_news;
    QVBoxLayout *lay_left;
    QCalendarWidget *calendar;
    QPalette btn_palette;
    QPixmap btn_pixmap;

    DisplayButton *m_ReturnToday;
    DisplayButton *m_ShowClock;
    DisplayButton *m_ConfigureButton;
    DisplayButton *m_AboutButton;
    QHBoxLayout* toolLayout;
    QDate dateEnd;//当前日历页的开始与结束日期

private slots:
    void ShowClockButtonClicked();
    void ReturnToday();
    void AboutButtonClicked();
    void reformatCalendarPage();    //当前日期页发送改变
    void whenSelectionChanged();    //当前被选中的日期发送改变

    void studyBtnClicked();
    void friendBtnClicked();
    void newsBtnClicked();

signals:
    void sigClockButtonClicked();
    void sigBtnStudyClicked();
    void sigBtnFriendClicked();
    void sigBtnNewsClicked();
    void sigSelectionChanged();
    void sigFriendDataUpdate();
};

#endif // MAIN_LEFT_WIDGET_H
